import request from '@/utils/request'

export function getRoles(params) {
  return request({
    url: '/sys/role',
    method: 'get',
    params
  })
}
export function deleteRoleById(id) {
  return request({
    url: '/sys/role/' + id,
    method: 'delete'
  })
}
/**
 * @description: 新增角色
 * @param {*} data {name,description}
 * @return {*}
 */
export function addRole(data) {
  return request({
    url: '/sys/role',
    method: 'post',
    data
  })
}

export function updateRoleById(data) {
  return request({
    url: '/sys/role/' + data.id,
    method: 'put',
    data

  })
}
export function getRoleDetailById(id) {
  return request({
    url: `/sys/role/${id}`,
    method: 'get'
  })
}
//给角色分配权限
export function assignPermissions(data) {
  return request({
    url: `/sys/role/assignPrem`,
    method: 'put',
    data
  })
}
